package com.group.finance.controller;


import com.group.commons.util.ResponseInfo;
import com.group.commons.util.ResponseStatus;
import com.group.finance.entity.Settlement;
import com.group.finance.service.impl.SettlementServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  结算记录
 * </p>
 *
 * @author zgc
 * @since 2022-06-07
 */
@RestController
@RequestMapping("/settlement")
public class SettlementController {

    @Resource
    SettlementServiceImpl settlementService;

    //查询结算记录
    @GetMapping("/all/{current}/{size}")
    public ResponseInfo findAllSettlement(@PathVariable("current") int current, @PathVariable("size") int size) {

        List<Settlement> settlementList = settlementService.findAll(current, size);

        //返回响应体
        ResponseInfo<Object> objectResponseInfo = new ResponseInfo<>();
        objectResponseInfo.setData(settlementList);
        objectResponseInfo.setCode(200);
        objectResponseInfo.setMessage("返回结算记录");
        objectResponseInfo.setStatus(ResponseStatus.SUCCESS);
        return objectResponseInfo;
    }

}
